package ce.com.cenewbluesdk.proxy;

import android.content.Context;

/**
 * Created by Administrator on 2016/11/10 0010.
 */
public class BleFactory {
    private static BleFactory bleFactory;

    private CEDevK1Proxy k1Proxy;
    private CEDevK3Proxy k3Proxy;
    private CEDevK2Proxy k2Proxy;
    private CEDevK6Proxy k6Proxy;
    static Context context;

    public static void init(Context context){
        BleFactory.context=context;
    }


    public static BleFactory getInstance(){
        if(bleFactory==null){
            bleFactory=new BleFactory();
            BleFactory.context=context.getApplicationContext();
        }
        return bleFactory;
    }


    public  CEDevK1Proxy getK1Proxy(){
        if(k1Proxy==null){
            k1Proxy=new CEDevK1Proxy(context);
        }
        return k1Proxy;
    }
    public  CEDevK3Proxy getK3Proxy(){
        if(k3Proxy==null){
            k3Proxy=new CEDevK3Proxy(context);
        }
        return  k3Proxy;
    }

    public  CEDevK2Proxy getK2Proxy(){
        if(k2Proxy==null){
            k2Proxy=new CEDevK2Proxy(context);
        }
        return  k2Proxy;
    }
    public  CEDevK6Proxy getK6Proxy(){
        if(k6Proxy==null){
            k6Proxy=new CEDevK6Proxy(context);
        }
        return  k6Proxy;
    }

    public CEBluetoothProxyBase getProxy(int devType){
        switch (devType){
            case 2:
                return getK2Proxy();
            case 3:
                return getK3Proxy();
        }
        return null;

    }



}
